package com.antony.messageUser1017;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.net.Socket;

import javax.swing.JList;
import javax.swing.JTextArea;

public class ChatListener extends MouseAdapter implements ActionListener{

	private Socket sk;
	private JTextArea sentMsg;
	private JTextArea showMsg;
	public ChatListener(Socket sk,JTextArea sentMsg,JTextArea showMsg){
		this.sk = sk;
		this.sentMsg = sentMsg;
		this.showMsg = showMsg;
	}
	
	public void mouseClicked(MouseEvent e) {
		if(e.getClickCount()==2){
			JList list = (JList)e.getSource();
			String target = list.getSelectedValue().toString();
			System.out.println(target);
			ShowFrame frame = new ShowFrame(sk);
			frame.showChatFrame(target);
		}
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		
	}


}
